import { createRouter, createWebHashHistory } from 'vue-router'

import Tree from '../views/Tree.vue'

// 路由懒加载 避免加载js过大
const Chart = () => import('../views/Chart.vue')
const Login = () => import('../views/Login.vue')

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login,
    meta:{
      showNav: true
    }
  },
  {
    path: '/tree',
    name: 'Tree',
    component: Tree
  },
  {
    path: '/chart',
    name: 'Chart',
    component: Chart
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
